import { http } from "@/utils/http";
import { type orderType } from "./types";

// 获取药师待审核订单
export const getPendingOrderApi = (warehouseId: string) => {
  // console.log("getLogin data:", data);
  return http.request<any>("get", `/cp/drug-plans/pending/count`, {
    params: {
      warehouseId: warehouseId
    }
  });
};

//  查询最早待审核计划详情
export const getEarlistPendingOrderApi = (warehouseId: string) => {
  // console.log("getLogin data:", data);
  return http.request<orderType>("get", `/cp/drug-plans/earliest/pending`, {
    params: {
      warehouseId: warehouseId
    }
  });
};

// 审核供药计划
type approveType = {
  approvalComment: number | string;
  userId: string;
  rejectReason: string;
};
export const submitApproveApi = (planId: string, data: approveType) => {
  // console.log("getLogin data:", data);
  return http.request<orderType>("post", `/cp/drug-plans/${planId}/approve`, {
    params: data
  });
};
